<#include "../common/basePage.ftl">
<@addCSS [
"/app/lib/css/plugins/clockpicker/clockpicker",
"/app/lib/css/plugins/select2/select2.min",
"/app/lib/css/plugins/datapicker/datepicker3",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker.min",
"/app/lib/css/plugins/summernote/summernote-bs3",
"/app/lib/css/plugins/summernote/summernote",
"/app/lib/css/plugins/chosen/chosen",
"/app/lib/css/plugins/dataTables/datatables.min",
"/app/lib/css/plugins/footable/footable.core"
]/>

<@addJS [
"/app/lib/js/plugins/select2/select2.full.min",
"/app/lib/js/plugins/summernote/summernote.min",
"/app/lib/js/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/js/plugins/chosen/chosen.jquery",
"/app/lib/js/plugins/dataTables/datatables.min",
"/app/lib/js/plugins/footable/footable.all.min"

]/>

<@common "工作进展">
<style>
.footable-row-detail-name{
	width:80px;
}
</style>
<input type="hidden" id="group" value="workprogress"/>
<input type="hidden" id="item" value="workproject"/>
<div class="row">
    <div class="col-lg-12">
    
    
        <div class="ibox float-e-margins">
            <div class="ibox-title" >
             
               <h3 align="center">信息中心第<span id="week"></span>周工作表单</h3>
          
                <div class="ibox-tools">
                    
                </div>
            </div>
            <div class="ibox-content">
            	

                <table class="table table-striped table-bordered table-hover dataTables-example" id="tb1" >
                    <thead>
                 
                    <tr>
                        <th>分类</th>
                        <th>事项</th>
                        <th>责任人</th>
                        <th>本周工作进展</th>
                        <th>是否完成</th>
                        <th>未完成原因</th>
                        <th>解决措施</th>
                        <th>下周工作计划</th>
                        <th data-hide="phone,tablet">计划完成时限</th>
						<th>需部门或中心协调的问题</th>
					    <th>操作</th>
                    </tr>
                    
                         
                    </thead>
                    <tbody>
                       <#list datalist as data>
			            <tr class="gradeX">
			                <td >${(data.jobType)!}</td>
			                <td >${(data.jobName)!}</td>
			                <td >${(data.staffNameAll)!}</td>
			                <td >${(data.currentProgress)!}</td>
			                <td >${(data.doesFinish)!}</td>
			                <td >${(data.reason)!}</td>
			                <td >${(data.measure)!}</td>
			                <td >${(data.futurePlan)!}</td>
			                <td style="max-width:400px">${(data.planDeadline)!}</td>
	     					<td>${(data.upgradeIssue)!}</td>
				           <td><a href="javascript:void(0)" onclick="showform('${(data.progressId)!}')">反馈工作进度</a></td>
					 
			            </tr>
		         </#list>
                    </tbody>
                    <tfoot>
                    	<tr>
                      <th>分类</th>
                        <th>事项</th>
                        <th>责任人</th>
                        <th>本周工作进展</th>
                        <th>是否完成</th>
                        <th>未完成原因</th>
                        <th>解决措施</th>
                        <th>下周工作计划</th>
                        <th data-hide="phone,tablet">计划完成时限</th>
						<th>需部门或中心协调的问题</th>
					    <th>操作</th>
                    </tr>
                    </tfoot>
                </table>				
                <div class="footer">
		        </div> 
            </div>
        </div>
    </div>
<script>
    $(document).ready(function(){
        $("#week").html(theWeek());
        $('#data_1 .input-group.date.form_datetime').datetimepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            format: 'yyyy-mm-dd hh:ii:ss',
            minuteStep: 1,
            autoclose: true,
            endDate : new Date()  
        });
        
		$("#liableOrgan").trigger("chosen:updated");
		$("#liableOrgan").chosen({});
		
		$("#eventType").trigger("chosen:updated");
		$("#eventType").chosen({});
		
		$('.dataTables-example').DataTable({
            dom: '<"html5buttons"B>lTfgitp',
            pageLength:25,
            "ordering": false,
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]
        });
        
        $(".dataTables_length").hide();
        $(".dataTables_filter").hide();
        $(".dataTables_info").hide();

        
    });
    function theWeek() {
    var totalDays = 0;
    now = new Date();
    years = now.getYear()
    if (years < 1000)
        years += 1900
    var days = new Array(12);
    days[0] = 31;
    days[2] = 31;
    days[3] = 30;
    days[4] = 31;
    days[5] = 30;
    days[6] = 31;
    days[7] = 31;
    days[8] = 30;
    days[9] = 31;
    days[10] = 30;
    days[11] = 31;
     
    //å¤æ­æ¯å¦ä¸ºé°å¹´ï¼éå¯¹2æçå¤©æ°è¿è¡è®¡ç®
    if (Math.round(now.getYear() / 4) == now.getYear() / 4) {
        days[1] = 29
    } else {
        days[1] = 28
    }
 
    if (now.getMonth() == 0) {
        totalDays = totalDays + now.getDate();
    } else {
        var curMonth = now.getMonth();
        for (var count = 1; count <= curMonth; count++) {
            totalDays = totalDays + days[count - 1];
        }
        totalDays = totalDays + now.getDate();
    }
    //å¾å°ç¬¬å å¨
    var week;
    if( Math.round(totalDays / 7)==totalDays / 7){ week= totalDays / 7;}
    else {
        week=Math.ceil(totalDays / 7);
        
    }
    return week;
    }

    function showform(id){
    	window.location.href="${servePath}/pc/workingprogress/showform/" + id;
    }   
    function searchview(){
    	var eventType= $("#eventType_chosen .chosen-single").text();
    	eventType = eventType.substring(0,eventType.indexOf("("));
    	
    	var liableOrgan= $("#liableOrgan_chosen .chosen-single").text();
    	liableOrgan = liableOrgan.substring(0,liableOrgan.indexOf("("));
    	var data={
    		"title":$("#title").val(),
    		"eventType":eventType,
    		"startDateStr":$("#startDateStr").val(),
    		"endDateStr":$("#endDateStr").val(),
    		"flightNo":$("#flightNo").val(),
    		"flightLeg":$("#flightLeg").val(),
  
    		"liableOrgan":liableOrgan
    	};
    	
    	$.ajax(
			{
				url : webCfg.servePath + "/pc/eventreportinfo/listfilter",
				type : "POST",
				async:false,
				contentType : "application/x-www-form-urlencoded; charset=UTF-8",
				data : data
			}).done(
			function(data) {
				if ($('.dataTables-example').hasClass('dataTable')) {
                    dttable = $('.dataTables-example').dataTable();
                    dttable.fnClearTable(); //æ¸ç©ºä¸ä¸table
                    dttable.fnDestroy(); //è¿ååå§åäºçdatatable
                }
                $(".dataTables-example").find("tbody").html(data);
                $('.dataTables-example').DataTable({
            dom: '<"html5buttons"B>lTfgitp',
            pageLength:25,
            "ordering": false,
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]
        });
        
        $(".dataTables_length").hide();
        $(".dataTables_filter").hide();
        $(".dataTables_info").hide();
				
			}).fail(function(jqXHR, error) {
				alert("errorï¼");
		});
    }
    
    function viewreload(){
    	window.location.reload();
    }
    
    
   
	status('tb1');
</script>
</@common>
